<template>
    <div class="fullScreen bg-c-wh">
        <!-- header、倒计时、玩法提示等 -->
        <lot-header></lot-header>
        <div class="scroll-lot tx-s-14 top" v-if="lotData != null">
            <!-- 总和 -->
            <div v-show="lotIndex == 0">
                <div class="title-lot">总和</div>
                <lhc-options :title="['', '']" :content="zhCont" :odds="lotOdds" :temp="4"></lhc-options>
            </div>
            <!-- 五行 -->
            <div v-show="lotIndex == 1">
                <div class="title-lot">前后和</div>
                <lhc-options :title="['', '']" :content="qhhCont" :odds="lotOdds" :temp="4"></lhc-options>
                <div class="title-lot">单双和</div>
                <lhc-options :title="['', '']" :content="dshCont" :odds="lotOdds" :temp="4"></lhc-options>
                <div class="title-lot">五行</div>
                <lhc-options :title="['', '']" :content="wxCont" :odds="lotOdds" :temp="4"></lhc-options>
            </div>
            <!-- 正码 -->
            <div v-show="lotIndex == 2">
                <div class="title-lot">正码</div>
                <lhc-options :title="['zm', '']" :content="c1d80Cont" :odds="lotOdds.sz" :temp="4"></lhc-options>
            </div>
        </div>
        <!-- footer -->
        <div class="flex-box flex-pj lotteryFooter tx-s-14">
            <div class="tx-c-r bor-r-g footer-btn" @click="cancel">重置</div>
            <div class="flex-box flex-f1">
                <input v-model="money" class="input-ol-n wd-fh tx-c" type="number" placeholder="请输入单注金额" />
            </div>
            <div class="tx-c-g bor-l-g footer-btn" @click="confirm">确定</div>
        </div> 
    </div>
</template>
<script type="text/ecmascript-6">
import 'common/css/lottery.css'
import { mapGetters } from 'vuex'
import { isDefine, isEmptyObject, openLotOrder } from '../../../common/js/common'
import Trans from '../../../common/js/eventTrans'
import LotHeader from "../../../components/lottery/lot-header"
import LhcContTab from "../../../components/lottery/lhcContTab"
import LhcOptions from "../../../components/lottery/lhcOptions"
import { zhCont, qhhCont, dshCont, kbwxCont, numCont } from '../../../common/js/data'
export default {
    data () {
        return {
            allResult : [],
            money : '',
            zhCont : zhCont, // 总和内容
            qhhCont : qhhCont, // 前后和内容
            dshCont : dshCont, // 单双和内容
            wxCont : kbwxCont, // 五行内容
            c1d80Cont : numCont(1, 80, '')
        }
    },
    mounted () {
        var _this = this
        Trans.$on('togLotteryTab', function (msg) {
            _this.cancel()
        })
    },
    methods: {
        // 重置下注数据
        cancel () { 
            this.money = ''
            this.$store.state.lotOptTra = []
            this.$store.state.lotOptions = []
            this.$store.state.lotSelData = []
        },
        // 确定
        confirm () {
            const {lotStatus, lotSelData, lhcTra, lotTitle, lhcPlay} = this.$store.state
            if(lotStatus == 0){
                this.$alert('已封盘')
            }else if(lotStatus == -1){
                this.$alert('已关盘')
            }else if(isEmptyObject(lotSelData)){
                this.$toast('未下注', 2000)
            }else if(lotStatus == 1){
                openLotOrder(this.money)
            }
        },
        // 打开玩法提示
        showDesc () {
            this.$store.state.lotDesc = true
        },
        sxCont () {
            return sxCont(1, '')
        }
    },
    components: {
        LotHeader,
        LhcContTab,
        LhcOptions
    },
    computed: {
        ...mapGetters([
            'lotData',
            'lotOdds',
            'lotIndex'
        ])
    }
};
</script>
<style lang="stylus" scoped>
.top
    top : 10rem
</style>
